#include "plotviewcontrol.h"
#include "QDebug"

PlotViewControl* PlotViewControl::pInstance = NULL;

PlotViewControl::PlotViewControl(QObject *parent) :
    QObject(parent)
{

}

void PlotViewControl::PlotTest(void)
{
    double time[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
    double val[10] = {12, 32, 9, 22, 18, 4, 24, 12, 15, 17};

    curve = new QwtPlotCurve("Acc_X");
    curve->setSamples(time, val, 10);
}

void PlotViewControl::Send()
{
    qDebug()<<"Send";
    PlotTest();
    emit UpdateView(curve);
}

PlotViewControl* PlotViewControl::GetInstance()
{
    if(pInstance == NULL)
        pInstance = new PlotViewControl();

    return pInstance;
}

void PlotViewControl::DeleteInstance()
{
    if(pInstance == NULL)
        return;

    delete pInstance;
}